# -*- coding: utf-8 -*-
"""
@Time ： 2023/7/4 22:01
@Auth ： 叶东宇
@File ：evaluateReversePolishNotation.py
"""

def evalRPN(s):
    stack = []
    sim = ['+','-','*','/']
    for i in s:
        if i not in sim:
            stack.append(i)
        else:
            after = stack.pop()
            begin = stack.pop()
            res = int(eval(f'{begin}{i}{after}'))
            stack.append(res)
    return int(stack[0])


if __name__ == "__main__":
    s = ["10","6","9","3","+","-11","*","/","*","17","+","5","+"]
    print(evalRPN(s))